package mashuaiproject.mashuaiproject.controller;

import mashuaiproject.mashuaiproject.mapper.DelMapper;
import mashuaiproject.mashuaiproject.model.Users;
import mashuaiproject.mashuaiproject.serivce.DelSerivce;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@Controller
public class DelContrrler {
   @Autowired
  private DelSerivce delSerivce;

    @ResponseBody
    @GetMapping("/delComments")
    //删除评论
    public  String delComments(@RequestParam("commentId")Integer delId, HttpServletRequest request){
        Users users= (Users) request.getSession().getAttribute("user");
        System.err.println(users.getName()+"_删除——"+delId);
        //首先删除相关联的
        //1.删除该评论点赞信息

        int delFabulous=delSerivce.delFabuloud(delId,users.getId());

        return null;
    }
}
